home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / ShareMailGiftware / AmigaTalk / testfiles / TestGamePort < prev    next >
Text File  |  2002-10-27  |  1KB  |  53 lines

  1. gp <- AbsJoyStick new
  2. n  <- 0
  3.  
  4. gp openGamePort: 1 named: 'AbsJoy1'
  5.  
  6. gp clearGamePortBuffer
  7. gp setTimeTransition:   600 "60Hz * 10 seconds."
  8. gp setKeyTransition:    3   "Up & down presses."
  9. gp setXDeltaTransition: 1
  10. gp setYDeltaTransition: 1
  11.  
  12. n <- gp getTriggerTime
  13. ('getTriggerTime = ', n) print "When will we time-out?"
  14.  
  15. n <- gp getTriggerKeys
  16. ('Trigger Keys   = ', n) print
  17.  
  18. n <- gp getTriggerXDelta
  19. ('TriggerDeltaX  = ', n) print
  20.  
  21. n <- gp getTriggerYDelta
  22. ('TriggerDeltaY  = ', n) print
  23.  
  24. n <- gp getButtonCode
  25. ('Button Code    = ', n) print
  26.  
  27. n <- gp getQualifiers
  28. ('Qualifiers     = ', n) print
  29.  
  30. n <- gp getXPos
  31. ('X position     = ', n) print
  32.  
  33. n <- gp getYPos
  34. ('Y position     = ', n) print
  35.  
  36. 'Press the fire button...' print
  37.  
  38. gp waitForButton:    16r68   "wait for the fire button."
  39. gp waitForQualifier: 16r4000 "wait for the fire button."
  40.  
  41. "x & y position only assumes the values -1, 0 & +1 for Absolute Joysticks."
  42. "For x, -1 = left, 0 = no movement, & +1 = right."
  43. "For y, -1 = up,   0 = no movement, & +1 = down."
  44.  
  45. 'Move the JoyStick around...' print
  46.  
  47. gp waitForXPos: 1
  48. gp waitForYPos: 1
  49.  
  50. gp closeGamePort
  51.  
  52. 'AbsJoy1 now closed!' print
  53.